package org.bistu.course.service;

import java.util.List;

import org.bistu.course.bean.Grade;
import org.bistu.course.mapper.GradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class GradeService {
	@Autowired
	private GradeMapper gradeMapper;
	
	public List<Grade> findAll() {
		return gradeMapper.findAll();
	}
	
	@Transactional
	public void addGrade(Grade grade) {
		gradeMapper.addGrade(grade);
	}
	
	@Transactional
	public void updateGrade(Grade grade) {
		gradeMapper.updateGrade(grade);
	}
	
	@Transactional
	public void deleteGrade(int id) {
		gradeMapper.deleteGrade(id);
	}
	
	public Grade findById(int id) {
		return gradeMapper.findById(id);
	}
}
